import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
import { DownOutlined } from '@ant-design/icons';
import { useIntl } from '@ant-design/pro-provider';
import { omitBoolean } from '@ant-design/pro-utils';
import { ConfigProvider, Space } from 'antd-v4';
import { useContext } from 'react';

var defaultCollapseRender = function defaultCollapseRender(collapsed, _, intl, hiddenNum) {
  if (collapsed) {
    return _jsxs(_Fragment, {
      children: [intl.getMessage('tableForm.collapsed', '展开'), hiddenNum && "(".concat(hiddenNum, ")"), _jsx(DownOutlined, {
        style: {
          marginLeft: '0.5em',
          transition: '0.3s all',
          transform: "rotate(".concat(collapsed ? 0 : 0.5, "turn)")
        }
      })]
    });
  }

  return _jsxs(_Fragment, {
    children: [intl.getMessage('tableForm.expand', '收起'), _jsx(DownOutlined, {
      style: {
        marginLeft: '0.5em',
        transition: '0.3s all',
        transform: "rotate(".concat(collapsed ? 0 : 0.5, "turn)")
      }
    })]
  });
};
/**
 * FormFooter 的组件，可以自动进行一些配置
 *
 * @param props
 */


var Actions = function Actions(props) {
  var setCollapsed = props.setCollapsed,
      _props$collapsed = props.collapsed,
      collapsed = _props$collapsed === void 0 ? false : _props$collapsed,
      submitter = props.submitter,
      style = props.style,
      hiddenNum = props.hiddenNum;

  var _useContext = useContext(ConfigProvider.ConfigContext),
      getPrefixCls = _useContext.getPrefixCls;

  var intl = useIntl();
  var collapseRender = omitBoolean(props.collapseRender) || defaultCollapseRender;
  return _jsxs(Space, {
    style: style,
    size: 16,
    children: [submitter, props.collapseRender !== false && _jsx("a", {
      className: getPrefixCls('pro-form-collapse-button'),
      onClick: function onClick() {
        return setCollapsed(!collapsed);
      },
      children: collapseRender === null || collapseRender === void 0 ? void 0 : collapseRender(collapsed, props, intl, hiddenNum)
    })]
  });
};

export default Actions;